<?php

App::uses('AppModel', 'Model');

class Assist extends AppModel
{
    /** Al Agregar/eliminar/actualizar las constantes de los modelos implica ir
     * y actualizar los comentarios en los campos de la tabla asociada a este modelo.
     */
    const STATUS_ENABLED = 1;
    const STATUS_DISABLED = 0;

    public function getEnabledWithNumber() {
        $filters = array(
            'fields' => array(
                'name as text',
                'id as value',
            ),
            'conditions' => array(
                'status' => self::STATUS_ENABLED,
            ),
            'order' => array(
                'id ASC'
            ),
        );
        $records = $this->find('all', $filters);
        return $this->flatArray($records);
    }

    public function getShortNameEnabledWithNumber()
    {
        $filters = array(
            'fields' => array(
                'code as text',
                'id as value',
            ),
            'conditions' => array(
                'status' => self::STATUS_ENABLED,
            ),
            'order' => array(
                'id ASC'
            ),
        );
        $records = $this->find('all', $filters);
        return $this->flatArray($records);
    }

}
